angular.module('Controller')
##未使用
.controller('QgyScoreOrderDealCtrl',($scope,urls,$localStorage,NgTableParams,commonUtil,cryptUtil,wfAlert,commonConstant,$http, $uibModalInstance, items)->
    $scope.type=type=items.type
    $scope.data=data=items.data
    if data.status==2
        $scope.modalTitle='领取确认'
    else
        $scope.modalTitle='积分订单处理'

    $scope.modalEnableList=commonConstant.enabledList()
    if type=='deal' and data['serviceTime']==undefined
        data['serviceTime']=new Date()
        console.log(data.serviceTime)
    else
        data['serviceTime']=new Date(data['serviceTime'])
    _.extend $scope,
        dealData:()->
            status=undefined
            if data.status==2
                status=3
            else
                return
            reqData={
                "status":status
                "remark":data.remark
            }
            $http.put("/order/#{$scope.data.id}",reqData)
            .success((resp)->
                if resp.code==0
                    wfAlert.toastInfo($scope.modalTitle+'成功')
                    $uibModalInstance.close('done')
                else
                    wfAlert.toastError(resp.message)
            )
    $scope.confirm = ()->
        if type=='deal'
            $scope.dealData()
    $scope.cancel =()->
        $uibModalInstance.dismiss('cancel')
)